package cate.common.table.show.row;

import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import org.apache.commons.lang3.StringUtils;

@NoteClass("荣誉挂件")
public class PendantRow extends ERow {

    @NoteField("荣誉挂件tid")
    public int tid;

    @NoteField("激活条件判定")
    private String activeStr;

    @NoteField("属性")
    public String attrStr;

    @NoteField("经验")
    public int exp;

    @Override
    public void parse(XSSFRowWrap xrw) {
        super.parse(xrw);
        this.id = xrw.getInteger("ID", -1);
        this.tid = xrw.getInteger("ID", -1);
        this.activeStr = xrw.getString("激活条件判定");
        this.attrStr = xrw.getString("属性");
        this.exp = xrw.getInteger("经验");
    }

    public int condition;

    public int value;

    @Override
    public void decode() {
        if (StringUtils.isNotBlank(activeStr)) {
            String[] split = activeStr.split("#");
            if (split.length == 2) {
                condition = Integer.parseInt(split[0]);
                value = Integer.parseInt(split[1]);
            }
        }
    }
}
